#include <iostream>
#include <pthread.h>
#include <unistd.h>
using namespace std;

int g_num = 0;
void* startRoutine(void* args)
{
    // const char* name = (const char*)args;
    // sleep(1);
    // while(true)
    // {
    //     g_num++;
    //     cout << name << " , pid: " << getpid() << " g_num: " << g_num  << "\n" <<endl;
    //     sleep(1);
    // }
    // cout << "thread id: " << pthread_self() << endl;
    printf("thread id: %p\n", pthread_self());

}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, startRoutine, (void*)"new thread");
    sleep(1);
    // cout << "thread id: " << tid << endl;
    // printf("thread id: %p\n", tid);
    cout << tid << endl;
    // while(true)
    // {
    //     cout << " main thread , pid: " << getpid() << " g_num: " << g_num  << "\n" << endl;
    //     sleep(1);
    // }
    return 0;
}